home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
comm2
/
termsorc.lha
/
Extras
/
Source
/
term-source.lha
/
Matrix.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-26
|
19KB
|
790 lines
/*
** Matrix.c
**
** Single character entry
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
**
** :ts=4
*/
#include "termGlobal.h"
typedef struct MatrixInfo
{
UWORD CellWidth,
CellHeight;
UWORD Width,
Height;
UWORD PixelWidth,
PixelHeight;
WORD CurrentX,
CurrentY;
STRPTR *Labels;
LONG NumLabels;
struct TextFont *Font;
LONG CurrentIndex;
} MatrixInfo;
#define MIA_CellWidth (TAG_USER+0x70000)
#define MIA_CellHeight (TAG_USER+0x70001)
#define MIA_Width (TAG_USER+0x70002)
#define MIA_Height (TAG_USER+0x70003)
#define MIA_Labels (TAG_USER+0x70004)
#define MIA_NumLabels (TAG_USER+0x70005)
#define MIA_Font (TAG_USER+0x70006)
#define MIA_Index (TAG_USER+0x70007)
STATIC struct IClass *MatrixClass;
STATIC Object *MatrixGadget;
STATIC UBYTE TitleBuffer[256];
STATIC VOID __regargs
DrawCellText(struct RastPort *RPort,UWORD Left,UWORD Top,UWORD Width,UWORD Height,STRPTR Label)
{
struct TextExtent Extent;
LONG Len = strlen(Label);
if(Len = TextFit(RPort,Label,Len,&Extent,NULL,1,Width,32767))
{
Move(RPort,Left + (Width - Extent . te_Width) / 2,Top + (Height - Extent . te_Height) / 2 + RPort -> TxBaseline);
Text(RPort,Label,Len);
}
}
STATIC VOID __regargs
DrawCell(struct RastPort *RPort,UWORD PixelLeft,UWORD PixelTop,struct GadgetInfo *GadgetInfo,MatrixInfo *Info,UWORD x,UWORD y,BOOL Highlight)
{
UWORD Left,Top;
UWORD Shine,Shadow,Text,Fill;
LONG Index;
Left = PixelLeft + Info->CellWidth * x;
Top = PixelTop + Info->CellHeight * y;
if(Highlight)
{
Shine = GadgetInfo->gi_DrInfo->dri_Pens[SHADOWPEN];
Shadow = GadgetInfo->gi_DrInfo->dri_Pens[SHINEPEN];
Text = GadgetInfo->gi_DrInfo->dri_Pens[FILLTEXTPEN];
Fill = GadgetInfo->gi_DrInfo->dri_Pens[FILLPEN];
}
else
{
Shine = GadgetInfo->gi_DrInfo->dri_Pens[SHINEPEN];
Shadow = GadgetInfo->gi_DrInfo->dri_Pens[SHADOWPEN];
Text = GadgetInfo->gi_DrInfo->dri_Pens[TEXTPEN];
Fill = GadgetInfo->gi_DrInfo->dri_Pens[BACKGROUNDPEN];
}
SetDrMd(RPort,JAM1);
SetAPen(RPort,Shine);
Move(RPort,Left,Top + Info->CellHeight - 1);
Draw(RPort,Left,Top);
Draw(RPort,Left + Info->CellWidth - 1,Top);
SetAPen(RPort,Shadow);
Move(RPort,Left + 1,Top + Info->CellHeight - 1);
Draw(RPort,Left + Info->CellWidth - 1,Top + Info->CellHeight - 1);
Draw(RPort,Left + Info->CellWidth - 1,Top + 1);
SetAPen(RPort,Fill);
RectFill(RPort,Left + 1,Top + 1,Left + Info->CellWidth - 2,Top + Info->CellHeight - 2);
if((Index = y * Info->Width + x) < Info->NumLabels)
{
SetAPen(RPort,Text);
DrawCellText(RPort,Left + 1,Top + 1,Info->CellWidth - 2,Info->CellHeight - 2,Info->Labels[Index]);
}
}
STATIC VOID __regargs
DrawGrid(struct RastPort *RPort,UWORD PixelLeft,UWORD PixelTop,struct GadgetInfo *GadgetInfo,MatrixInfo *Info)
{
UWORD i,j,Left,Top,Bottom,Strange,Charm;
SetDrMd(RPort,JAM1);
Left = PixelLeft;
Top = PixelTop;
Bottom = PixelTop + Info->PixelHeight - 1;
Strange = GadgetInfo->gi_DrInfo->dri_Pens[SHINEPEN];
Charm = GadgetInfo->gi_DrInfo->dri_Pens[SHADOWPEN];
for(i = 0 ; i < Info->Width ; i++)
{
SetAPen(RPort,Strange);
Move(RPort,Left,Top);
Draw(RPort,Left,Bottom);
Left += Info->CellWidth;
SetAPen(RPort,Charm);
Move(RPort,Left - 1,Top);
Draw(RPort,Left - 1,Bottom);
}
Top = PixelTop;
for(j = 0 ; j < Info->Height ; j++)
{
Left = PixelLeft;
for(i = 0 ; i < Info->Width ; i++)
{
SetAPen(RPort,Strange);
Move(RPort,Left,Top);
Draw(RPort,Left + Info->CellWidth - 1,Top);
SetAPen(RPort,Charm);
Move(RPort,Left + 1,Top + Info->CellHeight - 1);
Draw(RPort,Left + Info->CellWidth - 2,Top + Info->CellHeight - 1);
Left += Info->CellWidth;
}
Top += Info->CellHeight;
}
}
STATIC VOID __regargs
NotifyIndex(struct IClass *class,Object *object,struct GadgetInfo *GInfo,struct opUpdate *msg,LONG Index)
{
struct TagItem Tags[3];
Tags[0] . ti_Tag = MIA_Index;
Tags[0] . ti_Data = Index;
Tags[1] . ti_Tag = GA_ID;
Tags[1] . ti_Data = ((struct Gadget *)object)->GadgetID;
Tags[2] . ti_Tag = TAG_DONE;
DoSuperMethod(class,object,OM_NOTIFY,Tags,GInfo,((msg->MethodID == OM_UPDATE) ? (msg->opu_Flags) : 0L));
}
STATIC ULONG __regargs
SetMethod(struct IClass *class,Object *object,struct opSet *SetInfo)
{
MatrixInfo *Info = INST_DATA(class,object);
struct TagItem *Tag;
if(Tag = FindTagItem(MIA_Index,SetInfo -> ops_AttrList))
{
struct RastPort *RPort;
if(RPort = ObtainGIRPort(SetInfo->ops_GInfo))
{
LONG Index = (LONG)Tag -> ti_Data;
SetFont(RPort,Info->Font);
if(Info->CurrentX != -1 && Info->CurrentY !=-1)
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,SetInfo->ops_GInfo,Info,Info->CurrentX,Info->CurrentY,FALSE);
if(Index >= 0 && Index < Info->Width * Info->Height)
{
Info->CurrentX = Index % Info->Width;
Info->CurrentY = Index / Info->Width;
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,SetInfo->ops_GInfo,Info,Info->CurrentX,Info->CurrentY,TRUE);
NotifyIndex(class,object,SetInfo->ops_GInfo,(struct opUpdate *)SetInfo,Index);
}
else
{
Info->CurrentX = Info->CurrentY = -1;
NotifyIndex(class,object,SetInfo->ops_GInfo,(struct opUpdate *)SetInfo,-1);
}
ReleaseGIRPort(RPort);
}
}
return(DoSuperMethodA(class,object,(Msg)SetInfo));
}
STATIC ULONG __regargs
RenderMethod(struct IClass *class,Object *object,struct gpRender *RenderInfo)
{
MatrixInfo *Info = INST_DATA(class,object);
LONG i;
UWORD x,y,Left,Top;
SetFont(RenderInfo->gpr_RPort,Info->Font);
Left = ((struct Gadget *)object)->LeftEdge;
Top = ((struct Gadget *)object)->TopEdge;
SetAPen(RenderInfo->gpr_RPort,RenderInfo->gpr_GInfo->gi_DrInfo->dri_Pens[BACKGROUNDPEN]);
RectFill(RenderInfo->gpr_RPort,Left,Top,Left + ((struct Gadget *)object)->Width - 1,Top + ((struct Gadget *)object)->Height - 1);
DrawGrid(RenderInfo->gpr_RPort,Left,Top,RenderInfo->gpr_GInfo,Info);
for(i = 0 ; i < Info -> NumLabels ; i++)
{
x = (i % Info->Width) * Info->CellWidth;
y = (i / Info->Width) * Info->CellHeight;
DrawCellText(RenderInfo->gpr_RPort,Left + x,Top + y,Info->CellWidth,Info->CellHeight,Info->Labels[i]);
}
return(TRUE);
}
STATIC ULONG __regargs
DisposeMethod(struct IClass *class,Object *object,Msg msg)
{
MatrixInfo *Info = INST_DATA(class,object);
if(Info->Font)
CloseFont(Info->Font);
return(DoSuperMethodA(class,object,msg));
}
STATIC ULONG __regargs
NewMethod(struct IClass *class,Object *object,struct opSet *SetInfo)
{
if(object = (Object *)DoSuperMethodA(class,object,(Msg)SetInfo))
{
MatrixInfo *Info = INST_DATA(class,object);
struct TagItem *Tag,*TagList = SetInfo -> ops_AttrList;
struct TextAttr *Font;
UWORD Width,Height;
Width = Height = 0;
Font = NULL;
memset(Info,0,sizeof(MatrixInfo));
while(Tag = NextTagItem(&TagList))
{
switch(Tag->ti_Tag)
{
case MIA_CellWidth:
Info->CellWidth = Tag->ti_Data;
break;
case MIA_CellHeight:
Info->CellHeight = Tag->ti_Data;
break;
case MIA_Width:
Info->Width = Tag->ti_Data;
break;
case MIA_Height:
Info->Height = Tag->ti_Data;
break;
case MIA_Labels:
Info->Labels = (STRPTR *)Tag->ti_Data;
break;
case MIA_NumLabels:
Info->NumLabels = Tag->ti_Data;
break;
case MIA_Font:
Font = (struct TextAttr *)Tag->ti_Data;
break;
case GA_Width:
Width = Tag->ti_Data;
break;
case GA_Height:
Height = Tag->ti_Data;
break;
}
}
if(Info->Labels && !Info->NumLabels)
{
while(Info->Labels[Info->NumLabels])
Info->NumLabels++;
}
if(Font && Info->CellWidth && Info->CellHeight)
{
if(!Info->Width)
Info->Width = Width / Info->CellWidth;
if(!Info->Height)
Info->Height = Height / Info->CellHeight;
if(Info->Width && Info->Height)
{
if(Info->Font = OpenFont(Font))
{
Info->CurrentX = -1;
Info->CurrentY = -1;
Info->PixelWidth = Info->Width * Info->CellWidth;
Info->PixelHeight = Info->Height * Info->CellHeight;
return((ULONG)object);
}
}
}
CoerceMethod(class,object,OM_DISPOSE);
}
return(0);
}
STATIC ULONG __regargs
InputMethod(struct IClass *class,Object *object,struct gpInput *InputInfo)
{
MatrixInfo *Info = INST_DATA(class,object);
ULONG Result = GMR_MEACTIVE;
BOOL Done = FALSE;
WORD x,y;
if(InputInfo -> gpi_IEvent -> ie_Class == IECLASS_RAWMOUSE)
{
if(InputInfo -> gpi_IEvent -> ie_Code == MENUDOWN)
{
Result = GMR_NOREUSE;
Done = TRUE;
}
else
{
if(InputInfo -> gpi_IEvent -> ie_Code == SELECTUP)
{
Done = TRUE;
if(Info -> CurrentX != -1 && Info -> CurrentY != -1)
{
Result = GMR_REUSE | GMR_VERIFY;
*InputInfo -> gpi_Termination = Info -> CurrentY * Info -> Width + Info -> CurrentX;
}
else
Result = GMR_NOREUSE;
}
}
if(Done && Info -> CurrentX != -1 && Info -> CurrentY != -1)
{
struct RastPort *RPort;
if(RPort = ObtainGIRPort(InputInfo->gpi_GInfo))
{
SetFont(RPort,Info->Font);
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,InputInfo->gpi_GInfo,Info,Info->CurrentX,Info->CurrentY,FALSE);
Info->CurrentX = -1;
Info->CurrentY = -1;
ReleaseGIRPort(RPort);
NotifyIndex(class,object,InputInfo->gpi_GInfo,(struct opUpdate *)InputInfo,-1);
}
}
}
if(!Done)
{
x = InputInfo->gpi_Mouse . X / Info->CellWidth;
y = InputInfo->gpi_Mouse . Y / Info->CellHeight;
if(InputInfo->gpi_Mouse . X < 0 || InputInfo->gpi_Mouse . Y < 0 || x >= Info->Width || y >= Info->Height)
x = y = -1;
if(x != Info->CurrentX || y != Info->CurrentY)
{
struct RastPort *RPort;
if(RPort = ObtainGIRPort(InputInfo->gpi_GInfo))
{
SetFont(RPort,Info->Font);
if(Info->CurrentX != -1 && Info->CurrentY != -1)
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,InputInfo->gpi_GInfo,Info,Info->CurrentX,Info->CurrentY,FALSE);
Info->CurrentX = x;
Info->CurrentY = y;
if(x != -1 && y != -1)
{
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,InputInfo->gpi_GInfo,Info,Info->CurrentX,Info->CurrentY,TRUE);
NotifyIndex(class,object,InputInfo->gpi_GInfo,(struct opUpdate *)InputInfo,y * Info->Width + x);
}
else
NotifyIndex(class,object,InputInfo->gpi_GInfo,(struct opUpdate *)InputInfo,-1);
ReleaseGIRPort(RPort);
}
}
}
return(Result);
}
STATIC ULONG __regargs
ActiveMethod(struct IClass *class,Object *object,struct gpInput *InputInfo)
{
MatrixInfo *Info = INST_DATA(class,object);
struct RastPort *RPort;
if(RPort = ObtainGIRPort(InputInfo->gpi_GInfo))
{
SetFont(RPort,Info->Font);
if(Info->CurrentX != -1 && Info->CurrentY !=-1)
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,InputInfo->gpi_GInfo,Info,Info->CurrentX,Info->CurrentY,FALSE);
Info->CurrentX = InputInfo->gpi_Mouse . X / Info->CellWidth;
Info->CurrentY = InputInfo->gpi_Mouse . Y / Info->CellHeight;
if(Info->CurrentX > Info->Width - 1)
Info->CurrentX = Info->Width - 1;
else
{
if(Info->CurrentX < 0)
Info->CurrentX = 0;
}
if(Info->CurrentY > Info->Height - 1)
Info->CurrentY = Info->Height - 1;
else
{
if(Info->CurrentY < 0)
Info->CurrentY = 0;
}
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,InputInfo->gpi_GInfo,Info,Info->CurrentX,Info->CurrentY,TRUE);
NotifyIndex(class,object,InputInfo->gpi_GInfo,(struct opUpdate *)InputInfo,Info->CurrentY * Info->Width + Info->CurrentX);
ReleaseGIRPort(RPort);
return(GMR_MEACTIVE);
}
else
return(GMR_NOREUSE);
}
STATIC ULONG __regargs
InactiveMethod(struct IClass *class,Object *object,struct gpGoInactive *InactiveInfo)
{
MatrixInfo *Info = INST_DATA(class,object);
if(Info -> CurrentX != -1 && Info -> CurrentY != -1)
{
struct RastPort *RPort;
if(RPort = ObtainGIRPort(InactiveInfo->gpgi_GInfo))
{
SetFont(RPort,Info->Font);
DrawCell(RPort,((struct Gadget *)object) -> LeftEdge,((struct Gadget *)object) -> TopEdge,InactiveInfo->gpgi_GInfo,Info,Info->CurrentX,Info->CurrentY,FALSE);
ReleaseGIRPort(RPort);
NotifyIndex(class,object,InactiveInfo->gpgi_GInfo,(struct opUpdate *)InactiveInfo,-1);
}
}
Info -> CurrentX = -1;
Info -> CurrentY = -1;
return(0);
}
STATIC ULONG __regargs
HitTestMethod(struct IClass *class,Object *object,struct gpHitTest *HitInfo)
{
MatrixInfo *Info = INST_DATA(class,object);
if(HitInfo -> gpht_Mouse . X < Info -> PixelWidth && HitInfo -> gpht_Mouse . Y < Info -> PixelHeight)
return(GMR_GADGETHIT);
else
return(0);
}
STATIC ULONG __saveds __asm
Dispatch(register __a0 struct IClass *class,register __a2 Object *object,register __a1 Msg msg)
{
switch(msg->MethodID)
{
case OM_NEW:
return(NewMethod(class,object,(struct opSet *)msg));
case OM_UPDATE:
case OM_SET:
return(SetMethod(class,object,(struct opSet *)msg));
case OM_DISPOSE:
return(DisposeMethod(class,object,msg));
case GM_RENDER:
return(RenderMethod(class,object,(struct gpRender *)msg));
case GM_HITTEST:
return(HitTestMethod(class,object,(struct gpHitTest *)msg));
case GM_GOINACTIVE:
return(InactiveMethod(class,object,(struct gpGoInactive *)msg));
case GM_GOACTIVE:
return(ActiveMethod(class,object,(struct gpInput *)msg));
case GM_HANDLEINPUT:
return(InputMethod(class,object,(struct gpInput *)msg));
default:
return(DoSuperMethodA(class,object,msg));
}
}
STATIC VOID
DeleteMatrixClass(VOID)
{
if(MatrixClass)
{
FreeClass(MatrixClass);
MatrixClass = NULL;
}
}
STATIC struct IClass *
CreateMatrixClass(VOID)
{
if(MatrixClass = MakeClass(NULL,GADGETCLASS,NULL,sizeof(MatrixInfo),0))
MatrixClass -> cl_Dispatcher . h_Entry = (HOOKFUNC)Dispatch;
return(MatrixClass);
}
VOID
CloseMatrixWindow()
{
CheckItem(MEN_MATRIX_WINDOW,FALSE);
if(MatrixWindow)
{
ClearMenuStrip(MatrixWindow);
CloseWindowSafely(MatrixWindow);
MatrixWindow = NULL;
}
if(MatrixGadget)
{
DisposeObject(MatrixGadget);
MatrixGadget = NULL;
}
DeleteMatrixClass();
}
BOOL
DispatchMatrixWindow(ULONG *MsgClass,UWORD MsgCode,ULONG MsgQualifier,UBYTE Char)
{
if(MatrixWindow)
{
switch(*MsgClass)
{
case IDCMP_RAWKEY:
if(!(MsgCode & IECODE_UP_PREFIX) && !(MsgQualifier & IEQUALIFIER_REPEAT) && !(MsgCode >= CURSOR_UP_CODE && MsgCode <= F10_CODE) && !(MsgCode >= HELP_CODE && MsgCode <= RAMIGA_CODE))
{
SetGadgetAttrs((struct Gadget *)MatrixGadget,MatrixWindow,NULL,
MIA_Index, Char,
TAG_DONE);
Delay(5);
SetGadgetAttrs((struct Gadget *)MatrixGadget,MatrixWindow,NULL,
MIA_Index, -1,
TAG_DONE);
}
break;
case IDCMP_CLOSEWINDOW:
*MsgClass = 0;
return(TRUE);
case IDCMP_GADGETUP:
*MsgClass = 0;
Char = MsgCode;
SerWrite(&Char,1);
break;
case IDCMP_IDCMPUPDATE:
*MsgClass = 0;
if((WORD)MsgCode < 0)
SetWindowTitles(MatrixWindow,LocaleString(MSG_MATRIX_WINDOW_TITLE),(STRPTR)~0);
else
{
UBYTE OctalBuffer[6],BinBuffer[10];
WORD i,Code;
OctalBuffer[0] = '0';
for(Code = MsgCode, i = 0 ; i < 3 ; i++)
{
OctalBuffer[2 - i + 1] = '0' + (Code & 7);
Code = Code >> 3;
}
OctalBuffer[4] = 0;
BinBuffer[0] = '%';
for(Code = MsgCode, i = 0 ; i < 8 ; i++)
{
BinBuffer[7 - i + 1] = '0' + (Code & 1);
Code = Code >> 1;
}
BinBuffer[9] = 0;
SPrintf(TitleBuffer,"%s [%ld · $%02lx · %s · %s]",LocaleString(MSG_MATRIX_WINDOW_TITLE),MsgCode,MsgCode,OctalBuffer,BinBuffer);
SetWindowTitles(MatrixWindow,TitleBuffer,(STRPTR)~0);
}
break;
}
}
return(FALSE);
}
struct Window *
OpenMatrixWindow(struct Window *Parent)
{
if(MatrixWindow)
{
WindowToFront(MatrixWindow);
ActivateWindow(MatrixWindow);
return(MatrixWindow);
}
else
{
struct RastPort RastPort;
struct TextFont *Font;
LONG i,MaxWidth,Width,Height;
InitRastPort(&RastPort);
Font = OpenFont(&UserFont);
SetFont(&RastPort,Font);
for(i = 0, MaxWidth = 0 ; i < 256 ; i++)
{
if((Width = TextLength(&RastPort,CharCodes[i],strlen(CharCodes[i]))) > MaxWidth)
MaxWidth = Width;
}
Width = 2 + MaxWidth + 2;
Height = 2 + RastPort . TxHeight + 2;
if(Parent -> WScreen -> WBorTop + Parent -> WScreen -> Font -> ta_YSize + 1 + Parent -> WScreen -> WBorBottom + 16 * Height > Parent -> WScreen -> Height || Parent -> WScreen -> WBorLeft + 16 * Width + Parent -> WScreen -> WBorRight > Parent -> WScreen -> Width)
{
DisplayBeep(Parent -> WScreen);
return(NULL);
}
if(CreateMatrixClass())
{
STATIC Tag Map[] = { MIA_Index, ICSPECIAL_CODE, TAG_DONE };
if(MatrixGadget = NewObject(MatrixClass,NULL,
GA_Left, Parent -> WScreen -> WBorLeft + 2,
GA_Top, Parent -> WScreen -> WBorTop + Parent -> WScreen -> Font -> ta_YSize + 1 + 2,
GA_Width, 16 * Width,
GA_Height, 16 * Height,
GA_RelVerify, TRUE,
ICA_TARGET, ICTARGET_IDCMP,
ICA_MAP, Map,
MIA_Width, 16,
MIA_Height, 16,
MIA_CellWidth, Width,
MIA_CellHeight, Height,
MIA_Labels, CharCodes,
MIA_NumLabels, 256,
MIA_Font, &UserFont,
TAG_DONE))
{
if(MatrixWindow = OpenWindowTags(NULL,
WA_Top, Parent -> TopEdge + Parent -> BorderTop,
WA_Left, Parent -> LeftEdge,
WA_Title, LocaleString(MSG_MATRIX_WINDOW_TITLE),
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_DragBar, TRUE,
WA_InnerWidth, 2 + (Width * 16) + 2,
WA_InnerHeight, 2 + (Height * 16) + 2,
WA_Activate, TRUE,
WA_Gadgets, MatrixGadget,
WA_CustomScreen, Parent -> WScreen,
WA_RMBTrap, TRUE,
WA_NewLookMenus, TRUE,
BackfillTag, &BackfillHook,
WA_SimpleRefresh, TRUE,
AmigaGlyph ? WA_AmigaKey : TAG_IGNORE, AmigaGlyph,
CheckGlyph ? WA_Checkmark : TAG_IGNORE, CheckGlyph,
TAG_DONE))
{
MatrixWindow -> UserPort = Parent -> UserPort;
if(ModifyIDCMP(MatrixWindow,Parent -> IDCMPFlags | IDCMP_GADGETUP | IDCMP_IDCMPUPDATE | IDCMP_REFRESHWINDOW))
{
SetMenuStrip(MatrixWindow,Menu);
MatrixWindow -> Flags &= ~WFLG_RMBTRAP;
CheckItem(MEN_MATRIX_WINDOW,TRUE);
return(MatrixWindow);
}
MatrixWindow -> UserPort = NULL;
CloseWindow(MatrixWindow);
MatrixWindow = NULL;
}
DisposeObject(MatrixGadget);
MatrixGadget = NULL;
}
DeleteMatrixClass();
}
CheckItem(MEN_MATRIX_WINDOW,FALSE);
return(NULL);
}
}